/*
 * Copyright 2018-2019 KunMinX
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain menu_text_color copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.gzwanchuang.xhgj.bridge.state.main;

import androidx.databinding.ObservableField;
import androidx.lifecycle.ViewModel;
import androidx.recyclerview.widget.RecyclerView;

import com.gzwanchuang.architecture.utils.DateUtil;
import com.gzwanchuang.xhgj.bridge.data.bean.ProgressBean;
import com.gzwanchuang.xhgj.ui.dialog.SelectMonthDialog;
import com.gzwanchuang.xhgj.ui.page.adapter.CountAdapter;

import java.util.ArrayList;

/**
 * TODO tip：每个页面都要单独准备一个 statusViewModel，
 * 来托管 DataBinding 绑定的临时状态，以及视图控制器重建时状态的恢复。
 * <p>
 * 如果这样说还不理解的话，详见 https://xiaozhuanlan.com/topic/9816742350
 * <p>
 * Create by KunMinX at 19/10/29
 */
public class CountFragmentViewModel extends ViewModel {


    public final ObservableField<String> time = new ObservableField<>();
    public final ObservableField<String> year = new ObservableField<>();
    public final ObservableField<String> month = new ObservableField<>();
    public final ObservableField<String> money = new ObservableField<>();
    public final ObservableField<String> fee = new ObservableField<>();

    public final ObservableField<CountAdapter> adapter = new ObservableField<>();
    public final ObservableField<RecyclerView.LayoutManager> layoutManager = new ObservableField<>();
    public final ArrayList<ProgressBean> data = new ArrayList<>();


    public SelectMonthDialog build;


    {
        adapter.set(new CountAdapter(data));
        year.set(String.valueOf(DateUtil.getYear()));
        month.set(String.valueOf(DateUtil.getMonth()));
        time.set(year.get() + "年" + month.get() + "月");
    }

}
